
public class J02_Change {

	public static void main(String[] args) {
		// 잔돈 계산하는 프로그램
		int change;
		int w10, w50, w100, w500, w1000, w5000, w10000, w50000, rest;
		
		// change = 87654321;
		change=8_7654_3210;  //JDK7, 자릿수구분 _
		w50000=change/50000;
		rest=change-(w50000*50000);
		w10000=rest/10000;
		rest=rest-(w10000*10000);
		w5000=rest/5000;
		rest=rest-(w5000*5000);
		w1000=rest/1000;
		rest=rest-(w1000*1000);
		w500=rest/500;
		rest=rest-(w500*500);
		w100=rest/100;
		rest=rest-(w100*100);
		w50=rest/50;
		rest=rest-(w50*50);
		w10=rest/10;
		
		System.out.println("5만원권\t"+w50000+"장");
		System.out.println("1만원권\t"+w10000+"장");
		System.out.println("5천원권\t"+w5000+"장");
		System.out.println("1천원권\t"+w1000+"장");
		System.out.println("5백원권\t"+w500+"개");
		System.out.println("1백원권\t"+w100+"개");
		System.out.println("5십원권\t"+w50+"개");
		System.out.println("1십원권\t"+w10+"개");
		
	}

}
